$OpenBSD: patch-tls_openssl_gtlsclientconnection-openssl_c,v 1.4 2017/04/30 11:55:52 ajacoutot Exp $

From c7eb9a88a2c3d89140d772c7891955a4db2749a8 Mon Sep 17 00:00:00 2001
From: Antoine Jacoutot <ajacoutot@gnome.org>
Date: Sun, 30 Apr 2017 12:52:00 +0200
Subject: Fix the build with libressl.

From b8d66d389cc7817691a5b39dd1eaa10907453223 Mon Sep 17 00:00:00 2001
From: Ignacio Casal Quinteiro <qignacio@amazon.com>
Date: Sun, 16 Apr 2017 18:59:15 +0200
Subject: Fix warnings pointed out by the new flags added to meson

--- tls/openssl/gtlsclientconnection-openssl.c.orig
+++ tls/openssl/gtlsclientconnection-openssl.c
@@ -381,7 +381,7 @@ retrieve_certificate (SSL       *ssl,
 
       key = g_tls_certificate_openssl_get_key (G_TLS_CERTIFICATE_OPENSSL (cert));
       /* increase ref count */
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
       CRYPTO_add (&key->references, 1, CRYPTO_LOCK_EVP_PKEY);
 #else
       EVP_PKEY_up_ref (key);
@@ -443,7 +443,7 @@ g_tls_client_connection_openssl_initable_init (GInitab
   /* Only TLS 1.2 or higher */
   SSL_CTX_set_options (priv->ssl_ctx, options);
 
-#if OPENSSL_VERSION_NUMBER >= 0x10200000L
+#if OPENSSL_VERSION_NUMBER >= 0x10200000L && !defined (LIBRESSL_VERSION_NUMBER)
   if (hostname)
     {
       X509_VERIFY_PARAM *param;
@@ -471,7 +471,7 @@ g_tls_client_connection_openssl_initable_init (GInitab
       return FALSE;
     }
 
-  data_index = SSL_get_ex_new_index (0, "gtlsclientconnection", NULL, NULL, NULL);
+  data_index = SSL_get_ex_new_index (0, (void *)"gtlsclientconnection", NULL, NULL, NULL);
   SSL_set_ex_data (priv->ssl, data_index, client);
 
 #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
